package com.scau.database.controller.user;

import com.scau.data.entity.UserDO;
import com.scau.database.entity.user.UserLoginVO;
import com.scau.database.enums.UserTypeEnum;
import com.scau.database.service.user.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.EnumSet;
import java.util.List;

/**
 * @ClassName: UserController
 * @Description: TODO
 * @Author: sunslikes
 * @Date: 2020/6/29 15:29
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/userlogin")
public class LoginController {

    @Autowired
    LoginService loginService;

    @PostMapping("/login")
    public UserLoginVO login(@RequestBody @Valid UserLoginVO userLoginVO) {
        return loginService.login(userLoginVO);
    }

    @PostMapping("/gettype")
    public EnumSet<UserTypeEnum> listUserType() {
        EnumSet<UserTypeEnum> userTypeEnumEnumSet = EnumSet.allOf(UserTypeEnum.class);
        return userTypeEnumEnumSet;
    }

}
